<?php

    include("header.php");

    setTabIndex(2);

    createPage("Liga - Zilveren Toren");

?>



<?php

    if ( isset($_GET['player_list_id']) == false ) {

        redirect("/tornooien/zt-php/view_players_list.php");

    }

    

    $playerListId = $_GET['player_list_id'];

    

    $connect = mysql_connect(DB_SERVER, DB_USER, DB_PWD);

    mysql_select_db(DB_CATALOG);

    $query = "select zp.index_nr, p.matricule, (select team_nr from zt_team where team_id = zp.team_id) as team_nr,

        p.nom_prenom, p.elo_calcul, p.club from zt_player_list zpl, zt_player zp, playernew p where zpl.player_list_id =

        zp.player_list_id and zp.player_key = p.matricule and zpl.player_list_id = ".$playerListId." order by zp.index_nr";



    $playersListDetail = array();

    if ($result = mysql_query($query, $connect)) {

       $index = 0;

       while ($row = mysql_fetch_assoc($result)) {

             $player = new Player;

             $player->index_nr = $row['index_nr'];

             $player->team_name = $row['team_nr'];

             $player->player_key = $row['matricule'];

             $player->player_name = $row['nom_prenom'];

             $player->elo = $row['elo_calcul'];

             $player->club_id = $row['club'];

             $playersListDetail[$index++] = $player;

       }

    }



    $result = mysql_query("SELECT c.clubname from club c join zt_player_list zpl on c.club_id = zpl.club_id

        where zpl.player_list_id = ".$playerListId);

    $row = mysql_fetch_assoc($result);

    $clubname = $row['clubname'];

    mysql_free_result($result);

?>





<table height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0" bgcolor="#FFFFFF">

	<tr>

		<td id="leftFiller" valign="top" height="100%" rowspan="3" bgcolor="#666666">

			<table border="0" cellpadding="0" cellspacing="0" height="100%" width="8px">

				<tr><td>&nbsp;</td></tr>

			</table>

		</td>

		<td id="header" valign="top" width="100%">

			<table border="0" width="100%" cellpadding="3" cellspacing="0" bgcolor="#10425b">
                <tr>
                    <td bgcolor="#666666" width="40%">
                        <?php include("inc_title.html"); ?>
                    </td>
                    <td bgcolor="#666666" align="right" valign="top">&nbsp;
                          <span class="headerSmall">Huidige versie PLAYER.DBF: <?=CURRENT_PLAYER_DBF?>
                        <?php
                        if (isset($user) && $user->club_id == 100) {
                        ?>
                        <br/>
                        <a class="headerSmall" href="import_player.php">laad andere versie</a>
                        <?php
                        }
                        ?>
                        </span>
                    </td>
                </tr>
            </table>
            <table align="center" border="0" width="100%" height="90%" cellpadding="0" cellspacing="0" style="border-top:#BCDD10 4px solid;">
                <tr>
                    <?php include("inc_sublinks.php"); ?> 
                </tr>

				<tr><td colspan="2" nowrap bgcolor="#BCDD10" height="4"><img src="../../assets/images/spacer.gif" alt="" height="1" width="1"></td></tr>

				<tr>

					<td>&nbsp;</td>

					<td valign="top">

						<table align="left" cellspacing="10" width="100%">

							<tr>

								<td>

                                    <span class="blackHeaderLarge"><?=CURRENT_ZT_TOURNAMENT?> - Spelerslijst <?=$clubname?></span>

									<br>&nbsp;<br>

                                    <a href="view_players_list.php"><img src="../../assets/images/24x24/shadow/document.gif" border="0" alt="Ga naar overzicht spelerslijsten"/>

                                    Ga naar overzicht spelerslijsten</a>

                                    <br>&nbsp;<br>

                                    <table width="65%" border="0" cellpadding="0" cellspacing="0" id="test">

                                        <?php

                                    		if (count($playersListDetail) == 0) {

                                        ?>

                                        <tr>

											<td colspan="11"><strong>Deze spelerslijst bevat nog geen spelers.</strong></td>

										</tr>

                                        <?php

                                            } else {

                                        ?>

										<tr>

											<td style="border-bottom:#DDDDDD solid 1px" width="5%"><strong>Volgnr</strong></td>

											<td style="border-bottom:#DDDDDD solid 1px" width="15%" align="center"><strong>Stamnr</strong>&nbsp;&nbsp;</td>

											<td style="border-bottom:#DDDDDD solid 1px" width="5%" align="center"><strong>Ploegnr</strong></td>

											<td style="border-bottom:#DDDDDD solid 1px" width="55%">&nbsp;&nbsp;<strong>Naam</strong></td>

											<td style="border-bottom:#DDDDDD solid 1px" width="10%" align="center"><strong>ELO</strong></td>

											<td style="border-bottom:#DDDDDD solid 1px" width="10%" align="center"><strong>Kring</strong></td>

										</tr>

										<?php

                                           		while ($player = current($playersListDetail)) {

                                            		$indexNr = key($playersListDetail);

                                            		$teamName = $player->team_name;

                                            		if (empty($teamName)) {

                                                    	$teamName = "&nbsp";

                                                    }

                                        	?>

                                            	<tr>

	                                                <td style="border-bottom:#DDDDDD solid 1px" align="center"><strong><?=$indexNr + 1?></strong></td>

	                                                <td style="border-bottom:#DDDDDD solid 1px" align="center"><?=$player->player_key?></td>

	                                                <td style="border-bottom:#DDDDDD solid 1px" align="center"><?=$teamName?></td>

	                                                <td style="border-bottom:#DDDDDD solid 1px">&nbsp;&nbsp;<?=strtoupper($player->player_name)?></td>

	                                                <td style="border-bottom:#DDDDDD solid 1px" align="center"><?=$player->elo?></td>

	                                                <td style="border-bottom:#DDDDDD solid 1px" align="center"><?=$player->club_id?></td>

	                                            </tr>

	                                    <?php

                                                	next($playersListDetail);

	                                    		}

                                        	}

										?>

										<tr>

											<td colspan="6">&nbsp;</td>

										</tr>

									</table>

								</td>

							</tr>

						</table>

					</td>

				</tr>

				<tr>

			</table>

		</td>

	</tr>

</table>



</body>

</html>

